#!/usr/bin/bash

# This script can be used to unwedge a stuck t38modem virtual modem.  In order
# to use this script, you'll need to do the following:
#
# Use the /etc/rc.d/rc.t38modem script provided to start/stop t38modem.  This
# will allow you to start up multiple virtual modems using a separate t38modem
# process for each line.  You can then start/stop/restart an individual modem
# line without interrupting the other ongoing faxes.
#
# Using visudo, add the following to /etc/sudoers:
#
#     # Hylafax system commands
#     uucp ALL=(ALL) NOPASSWD: /etc/rc.d/rc.t38modem
#
# Copy this file to the /var/spool/hylafax/etc and set its execute bit:
#
#     cp /usr/doc/hylafax-3.15/Hylafax/resetmodem /var/spool/hylafax/etc
#     chmod +x /var/spool/hylafax/etc/resetmodem
#

DEV=$(basename $1)

if [ "$DEV" = "ttyx0" -o "$DEV" = "ttyx1" -o "$DEV" = "ttyx2" -o "$DEV" = "ttyx3" ]; then
  sudo /etc/rc.d/rc.t38modem "${DEV}_restart"
fi


